let str = 'www.com.baidu?a=1&b=2&cd6=322222'
function getObj(str) {
  let t = str.indexOf('?')
  let newStr = str.slice(t + 1).split('&')
  let obj = {}
  newStr.forEach(v => {
    let index = v.indexOf('=')
    let left = v.slice(0, index)
    let right = v.slice(index + 1)
    obj[left] = right
    return v
  })
  console.log(obj)
}
getObj(str)